﻿using System;
using System.Collections.Generic;
using LiSA_Server.Base.NHibernate.Models;
using NHibernate;
using NHibernate.Mapping.ByCode.Conformist;

namespace LiSA_Service.ResearchProjects.Models
{
    public class Article : Entity
    {
        public virtual string BibtexTitle { get; set; }

        public virtual string Author { get; set; }

        public virtual string Organization { get; set; }

        public virtual string Domain { get; set; }

        public virtual string Title { get; set; }

        public virtual string Text { get; set; }

        public virtual string Abstract { get; set; }

        public virtual string PublicationDate { get; set; }

        public virtual string Database { get; set; }

        public virtual string Type { get; set; }

        public virtual string WordCloud { get; set; }

        public virtual string KeyWords { get; set; }

        public virtual string MinedKeyWords { get; set; }

        /// <summary>
        /// Additional fields that may or may not be relevant in the future. Save!
        /// </summary>
        public virtual ICollection<ArticleField> Fields { get; set; }
    }
    
    /// <summary>
    /// The ArticleFeedback mapping.
    /// </summary>
    public class ArticleMapping : ClassMapping<Article>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ArticleMapping"/> class.
        /// </summary>
        public ArticleMapping()
        {
            this.Property(x => x.BibtexTitle, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Author, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Organization, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Domain, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Title, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Abstract, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Text, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Database, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.Type, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.WordCloud, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.PublicationDate, x => x.Type(NHibernateUtil.StringClob));
            this.Property(x => x.MinedKeyWords, x => x.Type(NHibernateUtil.StringClob));
            this.Set(x => x.Fields, m => { }, r => r.Element());
        }
    }
}